package com.xian.operator;

public class OperatorDemo7 {
    public static void main(String[] args) {
        //目标：三目运算符
        double score = 98;
        String res = score >= 60 ? "考试通过" : "挂科";
        System.out.println(res);


        //需求：从两个整数中找出最大值
        int a = 100;
        int b = 1000;
        int max = a > b ? a : b;
        System.out.println(max);

        System.out.println("-----------------三个数取最大值------------------");

        int i = 10;
        int j = 30;
        int k = 50;

        int temp = i > j ? i : j;
        int resMax_ = temp > k ? temp : k;
        System.out.println(resMax_);

        System.out.println("-----------------三目运算符嵌套------------------");

        int resMax1 = i > j ? i > k ? i : k : j > k ? j : k;
        System.out.println(resMax1);


    }
}
